package Reflect;

import java.lang.reflect.Array;
import java.lang.reflect.Field;
import java.util.Arrays;

public class ReflectDemo9 {
    public static void main(String[] args) throws Exception {
        String s1="hello";
        String s2="hello";
        System.out.println("s1:"+s1);
        System.out.println("s2:"+s2);

        Class cla=String.class;
        Field field=cla.getDeclaredField("value");
        field.setAccessible(true);
        char[] c=(char[]) field.get(s1);
        System.out.println(Arrays.toString(c));
        char[] c1=new char[]{'j','a','v','a','!'};
        field.set(s1,c1);
        System.out.println("s1:"+s1);
        System.out.println("s2:"+s2);
        String s3="hello";
        System.out.println("s3:"+s3);
        System.out.println("hello");
        System.out.println("hello"+"word");
        String s4=",";
        System.out.println("hello"+s4+"word");
    }
}
